//
//  kata_StopCell.m
//  CityStar
//
//  Created by wangjia on 14-7-12.
//  Copyright (c) 2014年 kata. All rights reserved.
//

#import "kata_StopCell.h"
#import "imageUtil.h"
#import "HTDefine.h"

@implementation kata_StopCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setValueWithData:(int)i count:(int)count{
    if (i == 0) {
        self.btnCall.hidden = YES;
        self.lblTitle.text = @"下城区庆春路217号(近延安路):解放路哈哈哈哈";
        [self.btnStop setTitle:@"我要停车" forState:UIControlStateNormal];
        if (count == 1) {
            [self.ivNotice setImage:[UIImage imageNamed:@"spare"]];
        }
        else if (count == 2){
            [self.ivNotice setImage:[UIImage imageNamed:@"nevs"]];
        }
        else{
            [self.ivNotice setImage:[UIImage imageNamed:@"none"]];
        }
        
    }else{
        self.btnCall.hidden = NO;
        self.lblPrice.text = @"￥60/次";
        self.lblTitle.text = @"杭州顺丰代驾";
        [self.btnStop setTitle:@"我要代驾" forState:UIControlStateNormal];
        
        if (count<6) {
            [self.ivNotice setImage:[imageUtil imageWithColor:rgba(245, 44, 50, 1)]];
        }
        else if (count<11){
            [self.ivNotice setImage:[imageUtil imageWithColor:rgba(248, 135, 78, 1)]];
        }
        else if (count<20){
            [self.ivNotice setImage:[imageUtil imageWithColor:rgba(128, 219, 46, 1)]];
        }
        else{
            [self.ivNotice setImage:[imageUtil imageWithColor:rgba(70, 168, 254, 1)]];
        }
        [self.ivNotice setHighlightedImage:self.ivNotice.image];
    }
    self.lblCount.text = [@"" stringByAppendingFormat:@"%d",count];
    [self.lblTitle sizeToFit];
    
}

-(void)configWithMessage:(ParkMessage *)message
{
    if ([message.last intValue] == 0) {
        [self.btnStop setBackgroundImage:[UIImage imageNamed:@"nopark"] forState:UIControlStateNormal];
        [self.btnStop setBackgroundImage:[UIImage imageNamed:@"nopark"] forState:UIControlStateHighlighted];
    }
    self.lblTitle.text = [NSString stringWithFormat:@"%@",message.name];
    self.lblPrice.text = [NSString stringWithFormat:@"%@元/小时",message.price];
    self.lblLeftSize.text = [NSString stringWithFormat:@"%@m",message.distance];
}

@end
